﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace test
{
    public partial class ListInfo : Form
    {
        DataSet ds = new DataSet();
        public ListInfo()
        {
            InitializeComponent();
        }

        private void ListInfo_Load(object sender, EventArgs e)
        {
            FillListInfo();
        }
        //获取入住信息
        private void FillListInfo()
        {
            DBHelper dBHelper = new DBHelper();
            //删除之前的，重新创建
            ds = new DataSet();
            try
            {
                //编写sql语句
                String sql = "select po_id 编号, customer 旅客, housename 入住房屋, tel 电话, timeinto 入住时间 from po order by po_id";
                //创建适配器对象
                MySqlDataAdapter adapter = new MySqlDataAdapter(sql, dBHelper.Connection);
                //填充数据集
                adapter.Fill(ds, "RoomInfo");
                //数据绑定
                this.dgv_ListInfo.DataSource = this.ds.Tables["RoomInfo"];
            }
            catch (Exception e)
            {
                MessageBox.Show("获取入住信息失败！" + e, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    }
}
